package com.refactor.practice.RentalCalculateImp;

import com.refactor.practice.Movie;
import com.refactor.practice.Rental;
import com.refactor.practice.RentalCalculate;

/**
 * @Description TODO
 * @Author Yang
 * @Date 2024/10/10 1:06
 */
public class NewReleaseTypeCalculate implements RentalCalculate {


    @Override
    public double getTotalAmount(Rental each) {

        return each.getDayRented() * 3;
    }


    @Override
    public int getFrequentRenterPoints (Rental each){
        int frequentRenterPoints =1 ;
        //add bonus for a two day new release rental
        if ((each.getMovie().getPriceCode() == Movie.NEW_RELEASE) &&
                each.getDayRented() > 1) {
            frequentRenterPoints++;
        }

        return frequentRenterPoints;
    }
}

